package cn.tedu.jdbc;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.Statement;

public class Test2 {
    public static void main(String[] args) throws Exception {
        Class.forName("com.mysql.jdbc.Driver");
        String url="jdbc:mysql://localhost:3306/cgb211101?characterEncoding=utf8";
        Connection c = DriverManager.getConnection(url,"root","root");
        Statement s = c.createStatement();
        ResultSet r = s.executeQuery("select * from user");
        while (r.next()){
            int id = r.getInt("id");
            String name = r.getString("name");
            String pwd = r.getString("pwd");
            System.out.println(id+name+pwd);

        }

        r.close();
        s.close();
        c.close();



    }
}
